<!DOCTYPE html>
<html>
<head>
	<title></title>
	<style type="text/css">
		canvas{
			border: 1px solid #333;
		}
	</style>
</head>
<body>
	<canvas width="600" height="400" id="canvas"></canvas>
	<script type="text/javascript">
		//相当于拿到一张纸
		var canvas=document.getElementById("canvas");
		//获取画笔
		var ctx=canvas.getContext("2d");

		//直线
		ctx.moveTo(200,0)
		ctx.lineTo(200,400)
		ctx.stroke()

		//写文字
		ctx.font="30px Arial"
		ctx.fillStyle="red"
		ctx.textAlign="left"
		// ctx.textAlign="center"
		// ctx.textAlign="right"
		ctx.fillText("Hello World",200,100)
		// ctx.strokeText("Hello World",200,100)
	</script>
</body>
</html>